#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<map>

using namespace std;

string minWindow(string s, string t) {
    map<char, int> m;
    for (auto c : t) m[c]++;
    int n = s.size(), cnt = m.size();
    int begin = -1, len = n + 1;

    int l = 0;
    for (int r = 0; r < n; r++)
    {
        char c = s[r];
        m[c]--;
        if (m[c] == 0)   cnt--;
        while (cnt == 0)
        {
            if (r - l + 1 < len)
                begin = l, len = r - l + 1;
            char x = s[l];
            if (m[x] == 0)
                cnt++;
            m[x]++;
            l++;
        }
    }
    return begin < 0 ? "" : s.substr(begin, len);
}